{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "955c85fb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import xlsxwriter\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6d502a84",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Tool(object):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3f628ad4",
   "metadata": {},
   "outputs": [],
   "source": [
    "vuale_test = [[30,0,0,1,10], [0,30,0,1,10],[0,0,30,1,10]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "0acfb392",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[30, 0, 0, 1, 10]\n",
      "[0, 30, 0, 1, 10]\n",
      "[0, 0, 30, 1, 10]\n"
     ]
    }
   ],
   "source": [
    "for i in vuale_test:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "7877e981",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[30, 0, 0, 1, 10, 0, 30, 0, 1, 10, 0, 0, 30, 1, 10]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = []\n",
    "for i in vuale_test:\n",
    "#     print(i)\n",
    "    for y in range(len(i)):\n",
    "        a.append(i[y])\n",
    "a      \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "1a1e64e2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[30, 0, 0, 0, 30, 0, 0, 0, 30]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "906b6b52",
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "aa = [[30, 0, 0, 1, 10],\n",
    "      [0, 30, 0, 1, 10],\n",
    "      [0, 0, 30, 1, 10]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "e63fff6e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30\n",
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "for i in aa:\n",
    "    print(i[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "860fedf5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "30\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "for i in aa:\n",
    "    print(i[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "5f1b9a55",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n",
      "30\n"
     ]
    }
   ],
   "source": [
    "for i in aa:\n",
    "    print(i[2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "ca02b61a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[30, 0, 0, 1, 10, 0, 30, 0, 1, 10, 0, 0, 30, 1, 10]\n"
     ]
    }
   ],
   "source": [
    "v = []\n",
    "for i in aa:\n",
    "    vv =[]\n",
    "    for y in range(len(i)):\n",
    "        vv.append(i[y])\n",
    "    \n",
    "print(v)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "de4ae992",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[30, 0, 0], [0, 30, 0], [0, 0, 30], [1, 1, 1], [10, 10, 10]]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = []\n",
    "for i in range(5):\n",
    "    cc = []\n",
    "    for y in aa:\n",
    "        cc.append(y[i])\n",
    "    a.append(cc)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "8f331738",
   "metadata": {},
   "outputs": [],
   "source": [
    "path = os.path.join(os.path.abspath(''),'xlsxwriter_task.xlsx')\n",
    "wb = xlsxwriter.Workbook(path)\n",
    "ws = wb.add_worksheet('动画')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "87192e70",
   "metadata": {},
   "outputs": [],
   "source": [
    "style_han1 = wb.add_format({'font_size':10, 'bold':1, 'bg_color':'#FFE1FF',\n",
    "            'font_color':'#ffffff', 'align':'center', 'top':2, 'left':2,\n",
    "            'right':2, 'bottom':2})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "64db7d84",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "xlsxwriter.format.Format"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(style_han1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "72f0c072",
   "metadata": {},
   "outputs": [],
   "source": [
    "path = os.path.join(os.path.abspath(''),'aaaaaaaaaaaaa.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "d7db7533",
   "metadata": {},
   "outputs": [],
   "source": [
    "wb = xlsxwriter.Workbook(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "72732b20",
   "metadata": {},
   "outputs": [],
   "source": [
    "ws = wb.add_worksheet('动画')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "ecd0a8fe",
   "metadata": {},
   "outputs": [],
   "source": [
    "st = wb.add_format({'bold':1, 'border': 10, 'align': 'center'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "dd2c41df",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_test = ['陈','韩','黄','田','赵']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "8fd0b536",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ws.write_row(0,0,list_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "3be17f13",
   "metadata": {},
   "outputs": [],
   "source": [
    "cell_format = wb.add_format({'bold': True})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "8b93dceb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ws.set_row(0, 5, cell_format)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "687af548",
   "metadata": {},
   "outputs": [],
   "source": [
    "wb.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "c538c03e",
   "metadata": {},
   "outputs": [],
   "source": [
    "os.startfile(os.path.join(os.path.abspath(''),'aaaaaaaaaaaaa.xlsx'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "725bcd68",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
